package com.blog.service;

import com.blog.mapper.HrAccountMapper;
import com.blog.seckill.accounts.HrAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;

/**
 * @ClassName HrAccountBaseService
 * @Destription  HrAccount基础：增删改查
 * @Author 天堂小野花
 * @Date 2025/8/19  18:35
 * @Version 1.0
 */
@Service
public class HrAccountBaseService {
    @Autowired
    HrAccountMapper hrAccountMapper;
    //表 HrAccount
    public HrAccount selectHrAccountById(Integer id){
        return hrAccountMapper.selectByPrimaryKey(id);
    }
    public int insertHrAccount(HrAccount hrAccount){
        return hrAccountMapper.insert(hrAccount);
    }
    public int updateHrAccount(HrAccount hrAccount){
        return hrAccountMapper.updateByPrimaryKeySelective(hrAccount);
    }
    public int deleteHrAccountById(Integer id){
        return hrAccountMapper.deleteByPrimaryKey(id);
    }

    public List<HrAccount> selectAllHrAccount() {
        return hrAccountMapper.selectAllHrAccount();
    }

    @Transactional
    public int hrAccountAdjustByHrId(BigDecimal price, Integer hrid) {
        return hrAccountMapper.hrAccountAdjustByHrId( price,  hrid);
    }
}
